# -*- coding:utf-8 -*-
from django_filters import CharFilter, filters
from django_filters.filterset import FilterSet

from Apps.User.models import User


class UserFilter(FilterSet):
    username = filters.CharFilter(field_name='username', lookup_expr='contains')
    nickname = filters.CharFilter(field_name='nickname', lookup_expr='contains')
    email = filters.CharFilter(field_name='email', lookup_expr='contains')
    mobile = filters.CharFilter(field_name='mobile', lookup_expr='contains')

    class Meta:
        model = User
        fields = ["username", "nickname", "email", "mobile"]
        # fields = {
        #     "username": ["contains"],
        # }
